/**
 * User: Oleksii Savchenko
 * Date: 29.01.13
 * Time: 17:14
 */
describe('Method refresh', function(){

    it('should be available refresh methods', function(){
        expect(userAttributesController.refresh).toBeDefined();
    });

    it('should be refresh user attributes', function(){
        var mock  = sinon.mock(userService);

        mock.expects('getUserId')
            .once()
            .returns("fakeId");

        mock.expects('changeUserAttributes')
            .once()
            .withArgs("fakeId", userAttributesController._userAttributes);


        userAttributesController.refresh();

        mock.verify();
        mock.restore();
    });

    it('can return empty record, if method don\'t get user id', function(){
        var mock  = sinon.mock(userService);

        mock.expects('getUserId')
            .once()
            .returns("undefined");

        mock.expects('changeUserAttributes')
            .once()
            .withArgs('undefined', userAttributesController._userAttributes)
            .returns('');

        userAttributesController.refresh();
        mock.verify();
        mock.restore();
    });

})